/ Assembly List / LJCNetCommon / NetString / FormatValue

Namespace - LJCNetCommon


Parameters
value - The object value.
dataTypeName - The object data type name.

Returns

The formatted value.

Syntax

C#
public static String FormatValue(Object value, String dataTypeName)

Formats the column value for the SQL string. (D)

Remarks

Returns the string formatted value from the Value property based on the DataTypeName property.

If the DataType is Boolean, returns "1" or "0".
If the DataType is DateTime, returns a string Date or Minimum Date value.
If the DataType is string, returns a string with doubled single quotes.

Example

C#
using LJCNetCommon;

var dbColumnBool = new DbColumn("TestBool", "1", NetCommon.TypeBoolean);
var dbColumnDate = new DbColumn("TestDate", DateTime.Now()
, NetCommon.TypeDateTime);
var dbColumnString = new DbColumn("TestString", "string");

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.